<?php
require_once('lib/dbclass.php');
$db = new MySQL();

?>

<?php
if (! $db->Query("select * from divisi
	order by id_divisi desc")) $db->Kill(); 
?>


<h2>Admin Divisi</h2>

<div class="tabeledit">
<table border="0" width="100%">
	<tr>
	<th align="center" width="8%" bgcolor="#494949"><p>No</p></th>
	<th align="left" width="15%" bgcolor="#494949"><p>Kode</p></th>
	<th align="left" width="30%" bgcolor="#494949"><p>Nama Divisi</p></th>
	<th align="left" width="22%" bgcolor="#494949"><p>Aksi</p></th>
	</tr>
	<?php $no=1;?>
	<?php while($rs = $db->RowArray()):?>
	<tr>
	<td align="center"><?php echo $no?></td>
	<td><?php echo $rs['id_divisi']?></td>
	<td><?php echo $rs['divisi']?></td>
	<td><a class="btn btn-default btn-sm" href="index.php?q=32&id=<?php echo $rs['id_divisi'];?>"><i class="fa fa-cog"></i> Settings</a>
		<a class="btn btn-danger" href="hapus_divisi.php?id=<?php echo $rs['id_divisi'];?>" onclick="return cekHapus('<?php 
		echo $rs['nama_divisi'];?>');"><i class="fa fa-trash-o"></i> Delete</a></td>
	</tr>
	<?php $no++?>
	<?php endwhile;?>
</table>
</div>
<br/>
<br/>
<br/>
<br/>
<a href="?q=31" class="btn btn-danger">
Tambah Divisi
</a>	

<script language="JavaScript">
function cekHapus(nama){
	if(confirm("Yakin akan menghapus Divisi : \""+ nama +" ? \"")){
		return true;
	} else {
		return false;
	}
}
</script>

